package com.lebang.mapper;

import com.lebang.domain.MemberNewTrade;
import com.lebang.example.MemberNewTradeExample;
import com.lebang.model.cences.CencesCoreDataModel;
import com.lebang.model.cences.CensusModel;
import com.lebang.model.cences.MemberNewTradeCount;
import com.lebang.model.cences.OutLayCount;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * MemberNewTradeMapper继承基类
 */
@Mapper
public interface MemberNewTradeMapper extends MyBatisBaseDao<MemberNewTrade, Long, MemberNewTradeExample> {

    BigDecimal selectMyMoneyByCategory(@Param("category") String category,
                                       @Param("star") LocalDateTime star,
                                       @Param("end") LocalDateTime end,
                                       @Param("type") Integer type,
                                       @Param("appStore") String appStore);

    BigDecimal selectUserMoneyByCategory(@Param("category") String category,
                                         @Param("star") LocalDateTime star,
                                         @Param("end") LocalDateTime end,
                                         @Param("type") Integer type,
                                         @Param("appStore") String appStore);


    BigDecimal selectMyMoneyByCategoryList(@Param("star") LocalDateTime star,
                                           @Param("end") LocalDateTime end,
                                           @Param("list") List<String> sdk,
                                           @Param("type") Integer type,
                                           @Param("appStore") String appStore);


    BigDecimal selectUserMoneyByCategoryList(@Param("star") LocalDateTime star,
                                           @Param("end") LocalDateTime end,
                                           @Param("list") List<String> sdk,
                                           @Param("type") Integer type,
                                             @Param("appStore") String appStore);

    int countNotByCategory(@Param("star") LocalDateTime star,
                        @Param("end") LocalDateTime end,
                        @Param("category") String category,
                        @Param("type") Integer type,
                        @Param("appStore") String appStore);

    int countByCategoryGroupByMemberId(@Param("star") LocalDateTime star,
                        @Param("end") LocalDateTime end,
                        @Param("category") String category,
                        @Param("type") Integer type,
                        @Param("appStore") String appStore);
    int countByNotCategoryGroupByMemberId(@Param("star") LocalDateTime star,
                                       @Param("end") LocalDateTime end,
                                       @Param("category") String category,
                                       @Param("type") Integer type,
                                       @Param("appStore") String appStore);

    int countByCategoryGroupByMemberIdEarn(@Param("star") LocalDateTime star,
                                           @Param("end") LocalDateTime end,
                                           @Param("appStore") String appStore,
                                           @Param("type") Integer type,
                                           @Param("count") int count,
                                           @Param("category") String category);

    List<MemberNewTrade> groupByExample(MemberNewTradeExample example);

    List<OutLayCount> countGroupByCategory(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end);

    int countByCategoryListGroupByMemberId(@Param("star") LocalDateTime star,@Param("end")  LocalDateTime end,@Param("category") List<String> category,@Param("type") Integer type,@Param("appStore") String appStore);

    List<CensusModel> allMoneyList(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end,@Param("type") Integer type);

    List<MemberNewTradeCount> sumByDate(@Param("star") LocalDateTime star,@Param("end")  LocalDateTime end,@Param("list") List<String> list);

    List<MemberNewTradeCount> countByDate(@Param("star") LocalDateTime star, @Param("end")  LocalDateTime end,@Param("list") List<String> list);

    List<CencesCoreDataModel> selectByAppStore(@Param("star") LocalDateTime star,@Param("end") LocalDateTime end,@Param("type") Integer type);
}